home *** CD-ROM | disk | FTP | other *** search
- .286
- ;================================================
- ; invoke ftfact, real, factorial
- ;
- ; Returns real = !factorial
- ;------------------------------------------------
- cseg segment word public 'code'
- assume cs:cseg,ss:cseg
- assume ds:cseg,es:cseg
-
- include math.inc
-
- ftfact proc near uses cx si di, real:NPR10, factorial:WORD
- local t:REAL10
-
- mov si, real ;
- invoke load1, si ; real = 1.0
- lea di, t ; address t
- mov cx, factorial ;
-
- .WHILE (1) ;
- invoke itoft, di, cx ; convert cx to a REAL10 (t)
- invoke ftmul, si, di ; real *= t
- dec cx ; next factorial value
- .BREAK .IF (cx == 1) ; don't mult by 1
- .ENDW
-
- ret
- ftfact endp
-
- cseg ends
- end